import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hi_flutter/app_page.dart';

class StatePage extends StatefulWidget {
  const StatePage({super.key});

  @override
  State<StatePage> createState() => _StatePageState();
}

class _StatePageState extends State<StatePage> {
  int _count = 0;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    print("initState");
  }

  @override
  Widget build(BuildContext context) {
    return AppPage(
      body: Center(
        child: Column(
            children: [
              Text('State生命周期 count: $_count'),
              ElevatedButton(
                  onPressed: (){
                    setState(() {
                      _count = _count + 1;
                    });
                  },
                  child: const Text('+1')
              ),
            ],
        ),
      ),
    );
  }


  @override
  void didUpdateWidget(covariant StatePage oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
    print("didUpdateWidget");
  }


  @override
  void deactivate() {
    // TODO: implement deactivate
    super.deactivate();
    print("deactivate");
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    print("dispose");
  }


  @override
  void reassemble() {
    // TODO: implement reassemble
    super.reassemble();
    print("reassemble");
  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
    print("didChangeDependencies");
  }




}
